﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DimensionAddIn.V2
{
    public class XBookManager
    {
        private static List<XBook> s_books = new List<XBook>();

        public static XBook Get(string bookname)
        {
            foreach (var book in s_books)
            {
                if (book.Name == bookname)
                {
                    return book;
                }
            }
            return null;
        }

        public static void Add(XBook book)
        {
            bool isExist = false;
            foreach (var item in s_books)
            {
                if (item.Name == book.Name)
                {
                    isExist = true;
                    break;
                }
            }
            if (!isExist)
            {
                s_books.Add(book);
            }
        }
    }
}
